<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!-- 编辑器 -->
<script type="text/javascript">

$(function(){
	//初始化表单验证
	$("#addForm").validate({
		ignore: "",
		 rules:{link:{url:true}}, 
		messages:{
			title: {required: "请输入标题"},
			content: {required: "请输入说明文字"},
		/* 	thumb: {required: "请添加图片"}, */
			link: {required: "请输入链接"}
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
					case 5:
						Kit.alert("图片上传失败，请重新上传");return;
					case -1:
						Kit.alert("网络繁忙...，请重试");
						addDialog.close();
						location.href=""
						return;
					case 0:
						dataPaginator.loadPage(1);
						addDialog.close();
					}
				}
			});
		}
	});
});

</script>
<script type="text/javascript">  

	   $(".radip_tip").each(function(){
		   $(".radip_tip").css("font-style","normal");
		   $(".radip_tip").css("font-size","12px");
		   $(".radip_tip").css("color","#abadaf");
		  });

</script>
<form id="addForm" action="${BASE_PATH}/wx/homeWindow/doAdd" method="post" class="form-horizontal" enctype="multipart/form-data">

	<div class="form-group">
		<label class="col-lg-2 control-label">图片设置：</label>
		<div class="col-lg-9">
			<input type="file" id="thumb" name="thumb" accept="image/jpg,image/png" title="选择文件" required>
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success">*建议640px*360px，大小30K以内，建议PNG格式，支持JPEG、PNG</span></div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">弹窗标题：</label>
	    <div class="col-lg-9">
        	<input type="text" name="title" value="" class="form-control" placeholder="请输入标题" maxlength="30">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label">说明文字：</label>
	    <div class="col-lg-9">
        	<!-- <input type="text" name="content" value="" class="form-control" placeholder="请输入说明文字" required maxlength="100">-->	     
            <textarea name="content" style="height:100px;resize: none;" class="form-control" placeholder="请输入说明文字" required maxlength="100"></textarea>
          </div>
	</div>

	<div class="form-group">
	    <label class="col-lg-2 control-label">跳转连接：</label>
	    <div class="col-lg-9">
             <input type="text" name="link" value="" class="form-control" placeholder="请输入链接地址" maxlength="200" required>
	    </div>
	</div>
	<h3>推送设置</h3>
	<div class="form-group">
	    <label class="col-lg-2 control-label">首页弹窗：</label>
	    <div class="col-lg-9">
        	<ul class="iCheckList">
        	   	<li><input type="radio" class="iCheck" name="isPopup" value="0" > 否</li>
	    		<li><input type="radio" class="iCheck" name="isPopup" value="1" checked> 是</li>
	    	</ul>
	    </div>
	</div>
	<div class="form-group" >
	    <label class="col-lg-2 control-label">推送时间：</label>
	    <div class="col-lg-9">
        	
        	   	 <label id="instantly"><input type="radio"  name="pushDateTypes" checked/> 立即推送 </label>
	    		 <label id="givenTimer"><input type="radio"  name="pushDateTypes"  /> 特定时间 </label>
	    	
	    	<div id="showHide" style="padding-left: 3rem;display:none">
		    	<p >
		    	   <input type="radio" class="iCheck"  name="pushDateType" value="1"  /> 会员生日<i class="radip_tip">(生日礼)</i>
		    	   <input type="radio" class="iCheck"  name="pushDateType" value="2" /> 登录日期<i class="radip_tip">(生产礼)</i>
		    	   <input type="radio" class="iCheck"  name="pushDateType" value="3" /> 进入会员中心<i class="radip_tip">(入会礼)</i>		    	   
		    	</p>
		    	<P>
		    	   <input type="radio" class="iCheck"  name="pushDateType" value="4" />自定义
		    	   <input type="text"  name="pushDate" value="" class="iCheck form-control width120 datetimepicker" data-format="yyyy-mm-dd"  placeholder="自定义时间" style="display: inline-block;margin-left: 5px;">
		    	 </P>
	    	  </div>
	    	</div>
	</div>
	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" autocomplete="off" >提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left" type="button" onclick="javascript:addDialog.close();" autocomplete="off">取消</button></div>
	</div>
</form>
<script>

	var givenTimer=document.getElementById("givenTimer");
	var instantly=document.getElementById("instantly");
    var showHide=document.getElementById("showHide");
	var par=givenTimer.firstChild;
	var npar=instantly.firstChild;
	//选中时间
	givenTimer.onclick=function(){
		par.checked="checked";
		npar.checked="";
		showHide.style.display="block"
	}
	//立即推送
	instantly.onclick=function(){
		par.checked="";
		npar.checked="checked";
		showHide.style.display="none"
	}	
</script>
